home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
totsrc11.zip
/
TOTWIN.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-06-08
|
37KB
|
1,303 lines
{ Copyright 1991 TechnoJock Software, Inc. }
{ All Rights Reserved }
{ Restricted by License }
{ Build # 1.10d }
Unit totWIN;
{$I TOTFLAGS.INC}
{
Development History:
Mar 15 91 1.00a Changed DesqView checks.
Mar 29 91 1.00b Added method SetWinRestrict to control
whether screen coords are set to within
window border.
Apr 4 91 1.00c Fixed window coordinate problem when a
window is stretched.
Apr 23 91 1.00d Enabled SetAllowMove for all window
types.
Feb 03 92 1.00e Captured 600 as Key Lastkey
Feb 24 93 1.10a Change Winkey to check vRemove
Mar 05 93 1.10b Changed memory check in Window Move
May 03 93 1.10c Set cursor to 1,1 when Window drawn
to avoid a range check error.
Wait for Mouse Release when closing
Jun 08 93 1.10d Added checks of vRemove before removing
windows (Thanks Bill).
}
{
Development Notes:
600 = Close Window
601 = Moved
602 = Resized
610 = Scroll Up One
611 = Scroll Down One
612 = Scroll Left one
613 = Scroll Right one
614 = Vertical Scroll Bar
615 = Horizontal Scroll Bar
}
INTERFACE
uses DOS, CRT, totSYS, totLOOK, totINPUT, totFAST, totMISC;
TYPE
WinPtr = ^WinOBJ;
pWinOBJ = ^WinOBJ;
WinOBJ = object
vBorder: tCoords;
vOuter: tCoords;
vClose: boolean; {is close icon active}
vUnderneathPtr: pointer; {ptr to saved screen}
vSavedSize: longint; {amount of memory saved}
vTitle: string; {window title}
vBorderAttr: byte; {border attribute}
vTitleAttr: byte; {title attribute}
vBodyAttr: byte; {main text attribute}
vIconsAttr: byte; {close and zoom icon attribute}
vStyle: byte; {border style}
vRemove: boolean; {remove the window when done}
vCursX: byte; {saved cursor location}
vCursY: byte; {saved -"- }
vCursTop: byte; {saved cursor size}
vCursBot: byte; {saved -"- }
vOldWin: tByteCoords; {previous window coords}
vOldWinConfine: boolean; {were window coords active}
vMVisible: boolean; {was mouse visible}
vFillWin: boolean; {clear window core when redrawn}
vWinRestrict: boolean; {are windows coords relative to border}
{methods...}
constructor Init;
procedure SetSize(X1,Y1,X2,Y2,Style:byte);
procedure SetTitle(Title:string);
procedure SetColors(Border,Body,Title,Icons: byte);
procedure SetRemove(On:boolean);
procedure SetClose(On:boolean);
procedure SetWinRestrict(On:boolean);
procedure SetWindow;
procedure GetSize(var X1,Y1,X2,Y2,Style:byte);
function GetX:byte;
function GetY:byte;
function GetStyle: byte;
function GetBorderAttr: byte;
function GetTitleAttr: byte;
function GetBodyAttr: byte;
function GetIconsAttr: byte;
function GetRemoveStatus: boolean;
procedure Save;
procedure PartSave(X1,Y1,X2,Y2:byte; var Dest);
procedure PartRestore(X1,Y1,X2,Y2:byte; var Source);
procedure ComputeSavedCoords;
procedure DrawCore;
procedure GrowDraw;
procedure Remove;
procedure WinGetKey(var K:word;var X,Y:byte);
procedure SetBoundary(X1,Y1,X2,Y2:byte); VIRTUAL;
procedure WinKey(var K:word;var X,Y:byte); VIRTUAL;
procedure Draw; VIRTUAL;
destructor Done; VIRTUAL;
end; {WinOBJ}
MoveWinPtr = ^MoveWinOBJ;
pMoveWinOBJ = ^MoveWinOBJ;
MoveWinOBJ = object (WinOBJ)
vBoundary: tCoords; {max area in which window can move}
vMoveKey: word;
vAllowMove: boolean;
{methods...}
constructor Init;
procedure SetMoveKey(K:word);
procedure SetAllowMove(On:boolean);
procedure BuildBackground(var BackScr: ScreenOBJ);
procedure RemoveShadow(var OriginalScreen: ScreenOBJ);
procedure RefreshUnderneath(BackScr: ScreenOBJ);
procedure WMove(UsingMouse:boolean;OldX,OldY:byte);
procedure WinKey(var K:word;var X,Y:byte); VIRTUAL;
procedure SetBoundary(X1,Y1,X2,Y2:byte); VIRTUAL;
destructor Done; VIRTUAL;
end; {MoveWinOBJ}
pScrollWinOBJ = ^ScrollWinOBJ;
ScrollWinOBJ = object (MoveWinOBJ)
vScrollV: boolean; {show vertical scroll bar}
vScrollH: boolean; {show horizontal scroll bar}
{methods ...}
constructor Init;
procedure SetScrollable(Vert,Horiz:boolean);
procedure DrawHorizBar(Current,Max: longint);
procedure DrawVertBar(Current,Max: longint);
procedure Winkey(var K:word;var X,Y:byte); VIRTUAL;
procedure Draw; VIRTUAL;
destructor Done; VIRTUAL;
end; {ScrollWinOBJ}
StretchWinPtr = ^StretchWinOBJ;
pStretchWinOBJ = ^StretchWinOBJ;
StretchWinOBJ = object (ScrollWinOBJ)
vZoomed: boolean; {is window zoomed at present}
vPreZoom: tCoords; {size of window in Unzoomed state}
vMinWidth: byte; {min width of SmartWin}
vMinDepth: byte; {min depth of SmartWin}
vStretchKey:word; {keycode for manual stretch}
vZoomKey:word; {keycode for zoom}
vAllowStretch: boolean; {is user allowed to stretch}
vSmartStretch: boolean; {refresh window during stretch}
{methods ...}
constructor Init;
procedure SetMinSize(Width,depth:byte);
procedure Stretch(UsingMouse:boolean;OldX,OldY:byte);
procedure SetAllowStretch(On:boolean);
procedure ToggleZoom;
procedure Refresh;
procedure StretchRefresh; VIRTUAL;
procedure Winkey(var K:word;var X,Y:byte); VIRTUAL;
procedure Draw; VIRTUAL;
destructor Done; VIRTUAL;
end; {StretchWinOBJ}
procedure WinInit;
IMPLEMENTATION
{|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
{ }
{ U N I T P R O C E D U R E S & F U N C T I O N S }
{ }
{|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
procedure Error(Err:byte);
{routine to display error}
const
Header = 'WinTOT error: ';
var
Msg : string;
begin
Case Err of
1: Msg := 'Not enough memory to create window';
2: Msg := 'Invalid window dimensions';
3: Msg := 'Not enough memory to create SmartWin';
else Msg := 'Unknown Error';
end; {case}
Writeln(Header,Msg);
{Maybe Add non-fatal compiler directive}
halt;
end; {Error}
{||||||||||||||||||||||||||||||||||||}
{ }
{ W i n O B J M E T H O D S }
{ }
{||||||||||||||||||||||||||||||||||||}
constructor WinOBJ.Init;
{}
begin
SetSize(10,5,70,20,1);
SetTitle('');
SetRemove(true);
with LookTOT^ do
SetColors(WinBorder,WinBody,WinTitle,WinIcons);
vUnderneathPtr := Nil;
vMVisible := true;
vClose := true;
vFillWin := true;
vWinRestrict := true;
end; {of const WinOBJ.Init}
procedure WinOBJ.SetSize(X1,Y1,X2,Y2,Style:byte);
{}
begin
{$IFDEF CH